<template>
    <el-table :data="list" style="width: 100%">
        <el-table-column prop="id" label="编号" />
        <el-table-column prop="name" label="资源名称" />
        <el-table-column prop="url" label="资源路径" />
        <el-table-column prop="description" label="描述" />
        <el-table-column prop="createTime" label="添加时间">
            <template #default="scope">
                <span>{{ fomatDate(scope.row.createTime) }}</span>
            </template>
        </el-table-column>
    </el-table>

    <ElConfigProvider :locale="zhCn">
        <el-pagination
            background
            v-model:currentPage="queryParams.pageNum"
            @size-change="pageSizeChagne"
            @current-change="currentChagne"
            v-model:page-size="queryParams.pageSize"
            layout="total,prev,sizes,prev, pager,next,jumper"
            :total="total"
        />
    </ElConfigProvider>
</template>
<script setup lang="ts">
import { ElConfigProvider, ElMessage, FormInstance } from 'element-plus';
import zhCn from 'element-plus/lib/locale/lang/zh-cn';
import { user } from '@/api';
import { reactive, ref, toRefs } from 'vue';
import { fomatDate } from '@/utils/index';
import { useRouter } from 'vue-router';
const state = reactive<{
    list: inRouterList[];
    total: number;
}>({
    list: [],
    total: 0,
});
const { list, total } = toRefs(state);
const queryParams = reactive<user>({
    keyword: '',
    pageNum: 1,
    pageSize: 10,
});
const xuan = () => {
    user.resoutlist(queryParams).then(res => {
        if (res.code === 200) {
            state.list = res.data.list;
            state.total = res.data.total;
            console.log('请求成功', state.list);
            console.log(res.data);
        }
    });
};
xuan();
const pageSizeChagne = () => {
    xuan();
};
const currentChagne = () => {
    xuan();
};
</script>
<style lang="less" scoped></style>
